def place(t):
    global x
    global a
    OK=True
    for j in range(t):
        if x[j] and a[t][j]=='0':
            OK=False
            break
    return OK

def  backtrack(t):
    global cn,bestn,n,bestx,x
    if (t > n):
        bestx = x[:]
        bestn=cn
        return
    if place(t-1):
        x[t-1]=1
        cn += 1
        backtrack(t+1)
        cn -= 1
    if (cn+n-t>bestn):
        x[t-1]=0
        backtrack(t+1)
if __name__ =="__main__":
    # a = [[0,1,1,0,0],[1,0,1,1,1],[1,1,0,1,1],[0,1,1,0,1],[0,1,1,1,0]]
    # a = [['0', '1', '1', '0', '0'], ['1', '0', '1', '1', '1'], ['1', '1', '0', '1', '1'], ['0', '1', '1', '0', '1'],['0', '1', '1', '1', '0']]
    # #
    # arr = input("")
    # arr1=[int(n) for n in arr.split(',')]
    # arr = input("")
    # arr2=[int(n) for n in arr.split(',')]
    # arr = input("")
    # arr3=[int(n) for n in arr.split(',')]
    # arr = input("")
    # arr4=[int(n) for n in arr.split(',')]
    #
    #
    # b=[0,1,1,0,0]
    # c=[0,1,1,1]
    # if(arr1==c):
    #     a=[arr1,arr2,arr3,arr4]
    # elif(arr1==b):
    #     arr = input("")
    #     arr5 = [int(n) for n in arr.split(',')]
    #     a=[arr1,arr2,arr3,arr4,arr5]
    # else:
    #     arr = input("")
    #     arr5 = [int(n) for n in arr.split(',')]
    #     arr = input("")
    #     arr6 = [int(n) for n in arr.split(',')]
    #     a=[arr1,arr2,arr3,arr4,arr5,arr6]


    G_list = []
    data = input()
    try:
        while data.split():
            G_list.append(data.split(','))
            data = input()
    except EOFError as e:
        print()
    # G_list.sort(key=lambda x: x[1], reverse=True)

    # print(type(G_list))
    finally:

        a=G_list

        # a = [[0,1,1,0,0],[1,0,1,1,1],[1,1,0,1,1],[0,1,1,0,1],[0,1,1,1,0]]
        # a = [['0', '1', '1', '0', '0'], ['1', '0', '1', '1', '1'], ['1', '1', '0', '1', '1'], ['0', '0', '0', '0', '1'],['0', '1', '1', '1', '0']]
        # print(a)


        n = len(a)
        x=[i for i in range(n)]
        bestx =None
        bestn = cn = 0
        backtrack(1)
        print("最大团顶点个数：", bestn)
        print("最大团为：", bestx)

